package Thread;/*
 *
 *@author:    Xavier
 *@data:      2024 - 01 - 13
 *@time:      16:59
 *
 */


import java.util.concurrent.BlockingDeque;
import java.util.concurrent.LinkedBlockingDeque;

// 使用阻塞队列
public class Demo18 {
    public static void main(String[] args) throws InterruptedException {
        BlockingDeque<String> queue = new LinkedBlockingDeque<>(10);

        queue.put("hello");
        String elem = queue.take();
        System.out.println(elem);

        elem = queue.take();
        System.out.println(elem);//这里出现了阻塞
        // offer和poll不带有阻塞功能
        // put和take带有阻塞功能
    }
}
